package com.itheima.chap05;

public class RateDiscountCoupon implements Counpon {
    private int threshold;
    private int discount;

    public RateDiscountCoupon(int threshold, int discount)
    {
        this.threshold = threshold;
        this.discount = discount;
    }

    public int calculateDiscount(double totalPrice)
    {
        return totalPrice >= threshold ? (int) (totalPrice * (100 - discount) / 100) : 0;
    }
}
